<!DOCTYPE html>
<html lang="en">
    <head>
        <meta charset="UTF-8">
        <meta name="viewport" content="width=device-width, initial-scale=1.0">
        <title>Document</title>
        <style>
            *{
                margin: 0px;
                padding: 0px;
                list-style: none;
            }
            h1{
                border: 3px solid #f60;
                width: 300px;
                height: 100px;
                display: block;
                margin: auto;
                text-align: center;
                
            }
            button{
                width: 100px;
                background: coral;
                margin-left: 20px;
                margin: 30px auto;
                display: block;
                text-align: center;
                
            }
        </style>
    </head>
    <body>
        <div class="ii" >
            <h1 id="txt">幸运女神在召唤</h1>
        </div>
        <button id="go">go</button>
        <button id="stop">stop</button>
        <script>
            var txt=document.getElementById('txt')
            var go=document.getElementById('go')   
            var stop=document.getElementById('stop')              
            var user=['1','2','3','4','5'];
            var timer;
            go.onclick=function(){
                clearInterval(timer)
               timer=setInterval(function(){
                    var n=parseInt(Math.random()*user.length);
                    txt.innerHTML=user[n];
                },50)
            }
            stop.onclick=function(){
                clearInterval(timer)
            }
        </script>
    </body>
</html>